﻿<%@ WebHandler Language="C#" Class="ZSPichanPlanLookBoardHandler" %>

using System;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.Web.SessionState;
using System.IO;
using ReportBusiness;
public class ZSPichanPlanLookBoardHandler : IHttpHandler
{
    public bool IsReusable { get { return false; } }
    private ZSPichanPlanLookBoardBusiness wp = new ZSPichanPlanLookBoardBusiness();
    public void ProcessRequest(HttpContext context)
    {
        //批产、大修、检修、备件
        if (context.Request.QueryString["type"] != null && context.Request.QueryString["type"] == "GetData")
        {
            Dictionary<string, string> para = new Dictionary<string, string>();
            if (context.Request.Form["ordertypename"] != null)
            {
                para["ordertypename"] = context.Request.Form["ordertypename"].ToString();
            }

            DataTable dt = wp.GetPichanPlanInfo(para);
            var json = "{\"data\":" + JsonConvert.SerializeObject(dt)
                        + ",\"count\":" + dt.Rows.Count
                        + ",\"code\":" + "0"
                        + ",\"msg\":" + "0"
                        + "}";
            context.Response.ContentType = "text/json";
            context.Response.Write(json.ToString());
            context.Response.End();
        }
        //新机
        if (context.Request.QueryString["type"] != null && context.Request.QueryString["type"] == "GetXinjiData")
        {
            Dictionary<string, string> para = new Dictionary<string, string>();
            if (context.Request.Form["productfamilyname"] != null)
            {
                para["productfamilyname"] = context.Request.Form["productfamilyname"].ToString();
            }

            DataTable dt = wp.GetXinjiPlanInfo(para);
            var json = "{\"data\":" + JsonConvert.SerializeObject(dt)
                        + ",\"count\":" + dt.Rows.Count
                        + ",\"code\":" + "0"
                        + ",\"msg\":" + "0"
                        + "}";
            context.Response.ContentType = "text/json";
            context.Response.Write(json.ToString());
            context.Response.End();
        }
    }
}